package top.songxs.gmall.order.rpc;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.songxs.gmall.common.result.Result;
import top.songxs.gmall.common.result.ResultCodeEnum;
import top.songxs.gmall.order.biz.OrderBizService;
import top.songxs.gmall.order.entity.OrderInfo;
import top.songxs.gmall.order.vo.OrderConfirmVo;

@RestController
@RequestMapping("/api/inner/order")
public class OrderRpcController {


    @Autowired
    private OrderBizService orderBizService ;

    @GetMapping(value = "/orderConfirmData")
    public Result<OrderConfirmVo> orderConfirmData() {
        OrderConfirmVo orderConfirmVo = orderBizService.orderConfirmData();
        return Result.build(orderConfirmVo , ResultCodeEnum.SUCCESS) ;
    }


    @GetMapping(value = "/findById/{orderId}")
    public Result<OrderInfo> findById(@PathVariable(value = "orderId") Long orderId) {
        OrderInfo orderInfo = orderBizService.findById(orderId);
        return Result.build(orderInfo , ResultCodeEnum.SUCCESS) ;
    }
}
